/****************************************************
          File Name:7-5.cpp
          Author: Abby Cin
          Mail: abbytsing@gmail.com
          Created Time: Sat 20 Dec 2014 10:38:21 AM CST
*****************************************************/

#include<iostream>
using namespace std;

long rec(long src)
{
    long res;
    if(src == 0 || src == 1)
        return 1;
    else
    {
        res = src * rec(src - 1);
        return res;
    }
}

int main()
{
    long src;

    for(;;)
    {
        cout << "Enter a number: ";
        cin >> src;
        cout << "recursion is: " << rec(src) << endl;
    }

    return 0;
}
